{extend name='table'}

{block name="content"}
<div class="layui-tab layui-tab-card">

    <div class="layui-tab-content">
        {include file='apply/index_search'}
        <table id="TableList" data-url="{:sysuri('index')}" data-target-search="form.form-search"></table>
    </div>
</div>
<script>
    var maxWidth = window.innerWidth;
    var maxHeight = window.innerHeight;


    $(function () {
        $('#TableList').layTable({
            even: true, height: 'full',
            sort: {field: 'id', type: 'desc'},
            where: {type: '{$type|default="index"}'},
            cols: [[
                {field: 'LAY_NUM', title: '{:lang("序号")}', width: 100, align: 'center', },
                {field: 'account_name', title: '{:lang("所属学校")}', minWidth: 150, align: 'center' },
                {field: 'avatar', title: '{:lang("头像")}', align: 'center', width: 100, templet: function (d) {
                        if (!d.avatar) return '-';
                        return layui.laytpl('<div class="headimg headimg-ss shadow-inset margin-0" data-tips-image data-tips-hover data-lazy-src="{{d.avatar}}"></div>').render(d);
                    }
                },
                {field: 'index_user_name', title: '{:lang("申请人姓名")}', minWidth: 100, align: 'center'},
                {field: 'mobile', title: '{:lang("手机号")}', align: 'center', minWidth: 100},
                {field: 'sex_text', title: '{:lang("性别")}', align: 'center', minWidth: 100},
                {field: 'job_number', title: '{:lang("学号/工号")}', align: 'center', minWidth: 100},
                {field: 'edu_background_text', title: '{:lang("学历")}', align: 'center', minWidth: 100},
                {field: 'job_depart', title: '{:lang("院系/部门")}', align: 'center', minWidth: 100},
                {field: 'major', title: '{:lang("专业")}', align: 'center', minWidth: 100},
                {field: 'create_at', title: '{:lang("创建时间")}', minWidth: 100, align: 'center' },
                {toolbar: '#toolbar', title: '{:lang("操作面板")}', align: 'center', minWidth: 200, fixed: 'right'}
            ]]
        });

    });
</script>


<!-- 列表排序权重模板 -->
<script type="text/html" id="SortInputTpl">
    <input type="number" min="0" data-blur-number="0" data-action-blur="{:sysuri()}" data-value="id#{{d.id}};action#sort;sort#{value}" data-loading="false" value="{{d.sort}}" class="layui-input text-center">
</script>

<script type="text/html" id="toolbar">

    {{# if (d.status == 0) { }}
    <!--{if auth("agree")}-->
    <a class="layui-btn layui-btn-sm"   data-title="{:lang('同意')}" data-action='{:url("agree")}' data-value="id#{{d.id}}">{:lang('同意')}</a>
    <!--{/if}-->

    <!--{if auth("refuse")}-->
    <a class="layui-btn layui-btn-sm layui-btn-danger"  data-modal="{:url('refuse')}" data-value="id#{{d.id}}">{:lang('拒绝')}</a>
    <!--{/if}-->
    {{# } }}

    {{# if (d.status == 2 ) { }}
    <span style="color: red;">拒绝理由：</span> {{d.refuse_msg}}
    {{# } }}
    {{# if (d.status == 1 ) { }}
    <span style="color: green;">申请通过</span>
    {{# } }}

</script>
{/block}
